<!--
  @author yangjiangming
  @date 2018/11/26 10:00
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<head>
    <title>新增厂商订单</title>

    <th:block th:replace="common/common :: jscss"/>

</head>

<style>
    .table-box {
        padding: 10px 30px;
    }
    .layui-table-cell,.layui-form,.layui-table-box,.layui-table-body{
        overflow: visible;
    }
    .layui-table-cell {
        overflow: visible;
        height: 34px;
    }
    .layui-layer-content {
        overflow: visible !important;
    }
    .danger {
        border-color: #FF5722!important;
    }
    .content {
        padding: 60px 40px 40px 40px;
        text-align: center;
        font-size: 18px;
    }

    .layui-table-tool{
        line-height: 10px;
        min-height: 30px;
    }
    .layui-table, .layui-table-view{
        margin: 0;
    }
    .layui-table-body .layui-none{
        line-height: 10px;
    }
</style>

<body>

<div class="layui-fluid new-order-page">
    <div class="layui-card">
        <form method="post" onkeydown="if(event.keyCode==13){return false}" action class="layui-form" lay-filter="zmn-order-add-form">

            <input type="hidden" name="longitude" id="longitude"/>
            <input type="hidden" name="latitude" id="latitude"/>
            <input type="hidden" id="district"/>
            <input type="hidden" name="channelId" id="channelId" lay-filter="channelId"/>
            <input type="hidden" name="plat" id="plat" th:value="${plat}"/>
            <!-- 新单 -->
            <input type="hidden" name="type" id="type" th:value="1"/>

            <!--预分配服务商-->
            <input type="hidden" id="preManageCompanyId" name="preManageCompanyId">
            <input type="hidden" id="preManageCompanyName" name="preManageCompanyName">
            <!--地址info-->
            <input type="hidden" id="streetSource" name="streetSource" value="0">
            <input type="hidden" id="communityId">
            <!--<div class="layui-card-header" style="margin-top:10px;"><b>基本信息</b></div>-->
            <div class="layui-split">&nbsp;</div>

            <div>

                <!-- 联系电话 -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-required">联系电话</label>
                        <div class="layui-input-inline" style="width: 200px;">
                            <!-- 联系电话1 -->
                            <th:block th:replace="common/_orderAddTmpl :: inputOfTelephone1"/>
                        </div>
                        <label class="layui-form-label">联系电话</label>
                        <div class="layui-input-inline" style="width: 200px;">
                            <!-- 联系电话2 -->
                            <input class="layui-input"
                                   id="telephone2"
                                   type="text"
                                   name="telephone2"
                                   lay-verify="tel"
                                   placeholder="电话02"
                                   autocomplete="off" >
                        </div>
                        <div class="layui-input-inline" style="width: 190px;">
                            <!-- 联系电话3 -->
                            <input class="layui-input"
                                   id="telephone3"
                                   type="text"
                                   name="telephone3"
                                   lay-verify="tel"
                                   placeholder="电话03"
                                   autocomplete="off" >
                        </div>
                    </div>
                </div>
                <!-- 用户姓名、下单渠道 -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-required">客户姓名</label>
                        <div class="layui-input-inline" style="width: 200px;">
                            <th:block th:replace="common/_orderAddTmpl :: inputOfUserName"/>
                        </div>
                        <label class="layui-form-label layui-form-required">厂商</label>
                        <div class="layui-input-inline" style="width: 200px;">
                            <select id="factoryId" name="factoryId" lay-verify="required" lay-filter="factory" lay-search>
                                <option value=""></option>
                                <option th:each="item : ${factoryList}"
                                        th:value="${item.value}"
                                        th:text="${item.text}">
                                </option>
                            </select>
                        </div>

                        <div class="layui-input-inline" style="width: 170px;">
                            <input type="radio"
                                   id="bizType"
                                   name="bizType"
                                   th:each="item : ${bizTypeList}"
                                   th:value="${item.value}"
                                   th:title="${item.text}"
                                   th:checked="${item.value} == 2"
                                   lay-verify="required">
                        </div>

                    </div>
                </div>

                <!-- 用户性别 -->
                <div class="layui-form-item">

                    <div class="layui-inline" style="width: 326px;">
                        <!-- 用户性别 -->
                        <label class="layui-form-label layui-form-required">性别</label>
                        <div class="inline-block">
                            <input type="radio"
                                   name="gender"
                                   lay-verify="radio"
                                   th:each="item : ${gender}"
                                   th:value="${item.value}"
                                   th:title="${item.text}">
                        </div>
                    </div>
                </div>
                <!-- 用户地址-省、市 -->
                <div class="layui-form-item address">
                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-required">用户地址</label>
                        <div class="layui-input-inline" style="width: 200px;">
                            <select id="provinceId" name="provinceId" lay-verify="required" lay-filter="province" lay-search>
                                <option value="">省</option>
                                <option th:each="province : ${provinceList}" th:value="${province.value}" th:text="${province.text}"></option>
                            </select>
                        </div>
                        <div class="layui-input-inline select-city">
                            <select id="cityId"
                                    name="cityId"
                                    lay-verify="required"
                                    lay-filter="city"
                                    lay-search>
                                <option value="">市</option>
                                <option th:each="item : ${cityList}"
                                        data-th-data-pid="${item.pid}"
                                        th:value="${item.value}"
                                        th:text="${item.text}"></option>
                            </select>
                        </div>
                        <div class="layui-form-mid layui-word-aux"><span id="company" class="company"></span></div>
                        <a class="layui-form-mid zmn-btn-text" id="preCompany"></a>
                    </div>
                </div>
                <!-- 用户地址-区县、街道 -->
                <div id="fuzzy-address" class="layui-form-item address">
                    <div class="layui-inline">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-inline" style="width: 200px;">
                            <select id="countyId" name="countyId" lay-filter="countyId" lay-search lay-verify="required">
                                <option value="">请选择区县</option>
                            </select>
                        </div>
                        <div class="layui-input-inline" style="width: 315px;">
                            <select id="streetId"
                                    name="streetId"
                                    lay-filter="streetId"
                                    lay-search>
                                <option value="">请选择乡镇或街道</option>
                            </select>
                        </div>
                    </div>
                </div>

                <!-- 用户地址-map -->
                <div id="exact-address" class="layui-form-item layui-hide address">
                    <div class="layui-inline">
                        <label class="layui-form-label" ></label>
                        <div class="layui-input-inline input-large" id="street-wrapper">
                            <input class="layui-input"
                                   id="customerAddress"
                                   type="text"
                                   name="street"
                                   placeholder="搜索地点，选择小区，街道，大厦..."
                                   autocomplete="off"
                                   style="padding-right: 95px;">
                            <!--搜索建议-->
                            <button class="layui-btn layui-btn-normal" id="btn-map" type="button" style="position: absolute;top: 0;right: 0;">百度地图</button>
                            <div id="suggestPanel" class="suggestPanelBox layui-anim layui-anim-upbit">
                                <ul></ul>
                            </div>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline" id="county-list">
                        </div>
                    </div>
                </div>

                <!-- 用户地址-门牌 -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-inline input-large">
                            <input class="layui-input"
                                   type="text"
                                   name="address"
                                   maxlength="100"
                                   placeholder="请输入详细楼栋、门牌号"
                                   lay-verify="required"
                                   autocomplete="off">
                        </div>
                    </div>
                </div>
                <!-- 切换精确地址与模糊地址 -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-inline input-large">
                            <a class="btn-duty-time layui-hide" id="address-type-exact" href="javascript:void(0);">无法找到精确地址</a>
                            <a class="btn-duty-time" id="address-type-fuzzy" href="javascript:void(0);">切换为精确地址</a>
                        </div>
                    </div>
                </div>
                <!-- 服务分类、 服务产品、数量 -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-required">服务产品</label>
                        <div class="layui-input-inline" style="width: 200px;">
                            <select id="servCategoryId" name="servCategId" lay-verify="required"
                                    lay-filter="servCategory" lay-search>
                                <option value="">全部</option>
                                <option th:each="item : ${servCategList}"
                                        th:value="${item.value}"
                                        th:text="${item.text}">
                                </option>
                            </select>
                        </div>
                        <div class="layui-input-inline" style="width: 200px;">
                            <select id="productId" name="productId" lay-verify="required" lay-filter="productId"
                                    lay-search>
                                <option value="">全部</option>
                                <option th:each="item : ${productList}"
                                        th:value="${item.value}"
                                        th:text="${item.text}">
                                </option>
                            </select>
                        </div>
                        <div class="layui-input-inline" style="width: 106px;">
                            <input class="layui-input"
                                   id="count"
                                   type="text"
                                   name="number"
                                   placeholder="数量"
                                   autocomplete="off"
                                   min="1"
                                   max="10"
                                   lay-verify="required|count"
                                   style="padding-right: 40px">
                            <span class="order-number-unit" id="unit"></span>
                        </div>
                    </div>
                </div>
                <!-- 常见故障 -->
                <div class="layui-form-item" style="display: none">
                    <div class="layui-inline">
                        <label class="layui-form-label" >常见故障</label>
                        <div class="layui-input-block faults-wrapper" id="faults-wrapper"></div>
                    </div>
                </div>
                <!-- 其他故障 -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">其他故障</label>
                        <div class="layui-input-inline textarea-new-order">
                            <textarea id="fault-remark" name="faultRemark" placeholder="最长不能超300个字" class="layui-textarea" maxlength="300" lay-verify="maxLenTo300"></textarea>
                        </div>
                    </div>
                </div>
                <!-- 预约时间 -->
                <div class="layui-form-item duty-time-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">预约时间</label>
                        <div class="layui-input-inline layui-inline-text" id="duty-time-wrapper">
                            <span id="duty-time" th:text="${dutyTime}"></span>
                            <a class="btn-duty-time" id="btn-duty-time" href="javascript:void(0);">选择预约时间</a>
                            <button class="layui-btn" style="padding: 0;"></button>
                            <input id="duty-time-input"
                                   type="hidden"
                                   name="dutyTime"
                                   th:value="${dutyTime}"
                                   lay-verify="dutyTime"
                                   style="padding: 0;">
                        </div>
                        <div class="layui-input-inline">
                            <input id="duty-time-checkbox"
                                   type="checkbox"
                                   lay-skin="primary"
                                   name=""
                                   lay-filter="duty-time-checkbox"
                                   title="客户不确定上门时间">
                        </div>
                    </div>
                </div>

                <!-- 应付总价 -->
                <div class="layui-form-item" id="amount-wrapper" style="display: none;">
                    <div class="layui-inline">
                        <label class="layui-form-label">应付总价</label>
                        <div class="layui-input-inline" id="amount-clean" style="width: 725px;display: none;">
                            <span id="amount" style="color: red;"></span>元
                            <button class="layui-btn" style="padding: 0;"></button>
                        </div>
                        <div class="layui-input-inline" id="amount-others">
                            <span>上门检测后确定</span>
                            <a class="btn-duty-time" id="btn-price-table" href="javascript:void(0);">查看价格表</a>
                            <button class="layui-btn" style="padding: 0;"></button>
                        </div>
                    </div>
                </div>
                <!-- 下单备注 -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">下单备注</label>
                        <div class="layui-input-inline textarea-new-order">
                            <textarea class="layui-textarea"
                                      name="remark"
                                      maxlength="500"
                                      placeholder="最长不能超500个字"
                                      lay-verify="maxLenTo500"></textarea>
                        </div>
                        <span style="color: red;">注意：此处备注工程师APP、用户可见。</span>
                    </div>
                </div>

                <!-- 下单标志 -->
                <div class="layui-form-item" th:if="${#authPermit.checkPermit('/ys/factory/work/add/test.action')}">
                    <div class="layui-inline">
                        <label class="layui-form-label">下单标志</label>
                        <div class="layui-input-inline" style="width: 230px">
                            <input type="radio"
                                   name="test"
                                   lay-verify="radio"
                                   th:value="1"
                                   th:title="正常工单"
                                   th:checked="true"/>
                            <input type="radio"
                                   name="test"
                                   lay-verify="radio"
                                   th:value="2"
                                   th:title="测试工单"/>
                        </div>
                    </div>
                </div>

                <!-- 更多信息 -->
                <div class="layui-form-item" data-toggle="allModal">
                    <div class="layui-inline">
                        <label class="layui-form-label">更多信息</label>
                        <div class="layui-input-inline" style="margin-top: 8px;margin-left: -4px;">
                            <i class="layui-icon layui-icon-up" data-toggle="modal" data-target="#moreModal"></i>
                        </div>
                    </div>
                </div>

                <!-- 快递信息 -->
                <div class="layui-form-item layui-hide" id="moreModal">
                    <!-- 新机 -->
                    <div class="layui-form-item" id="newMachine">
                        <label class="layui-form-label"></label>
                        <th:block th:replace="common/_orderAddTmpl :: newMachine"/>
                    </div>

                    <!-- 新机 -->
                    <div class="layui-form-item" id="factoryPart">
                        <label class="layui-form-label"></label>
                        <th:block th:replace="common/_orderAddTmpl :: factoryPart"/>
                    </div>
                </div>

                <!-- 按钮 -->
                <div class="layui-form-item">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-block">
                        <div>
                            <button id="confirmbtn" type="button" class="layui-btn" lay-submit lay-filter="confirmbtn">保存</button>
                            <!--<button type="reset" class="layui-btn layui-btn-primary" >重置</button>-->
                        </div>
                    </div>
                </div>
                <div style="height: 1px"></div>
            </div>
        </form>
    </div>
</div>
<script type="text/html" id="btns">
    <a class="layui-btn layui-btn-xs" lay-event="del">删除</a>
</script>
<script type="text/html" id="btn-add">
    <a class="layui-btn layui-btn-xs" lay-event="add">增加</a>
</script>

<script type="text/html" id="expressCode-2">
    <input name="expressCode"
           lay-verify="required" class="layui-input" value="{{d.expressCode || ''}}"/>
</script>

<script type="text/html" id="number-input">
    <input name="number"
           lay-verify="required" class="layui-input" value="{{d.number || ''}}"/>
</script>

<script type="text/html" id="expressCompany-2">
    <select name="expressCompany"
            lay-verify="required"
            lay-filter="expressCompany"
            lay-search value="{{d.expressCompanyCode || ''}}">
        <option value="">物流公司</option>
        <option th:each="item : ${expressCompanyList}"
                th:value="${item.key}"
                th:text="${item.value}"></option>
    </select>
</script>

<script type="text/html" id="factoryParts">
    <select class="factoryPart" name="factoryPartId" lay-filter="factoryPartId" lay-verify="required" lay-ignore
            data-option-value="{{d.partId || ''}}" data-option-name="{{d.partName || ''}}" style="width: 100%;">
        <option value="">请选择</option>
    </select>
</script>

<script type="text/html" id="post-target">
    <select name="postTarget"
            lay-verify="required"
            lay-filter="number"
            lay-search value="{{d.number || ''}}">
        <option value="">请选择</option>
        <option value="1">寄给用户</option>
        <option value="2">寄给言而有信公司</option>
    </select>
</script>

<script type="text/html" id="remark">
    <input name="remark"
           lay-verify="required" class="layui-input" value="{{d.remark || ''}}"/>
</script>

<script th:inline="javascript">
    var json = {
        cityList: [[${cityList}]]
    };
    var plat = platMark.YEYX;

    var addOrderWebAk = [[${#baiduAkUtil.getAddOrderWebAk()}]];

    layui.config({
        base: "/static/js/module/",
        version: 20221013001
    }).extend({
        oms_order_factoryAdd: "order/zmn.oms.order.factoryAdd"
    }).use(['index', 'oms_order_factoryAdd']);
</script>

</body>
</html>